package scan

import (
	"database/sql"
	"reflect"
)

func scannerOf(dest reflect.Value, columnType *sql.ColumnType) sql.Scanner {
	addr := dest.Addr()
	if scanner := trySqlScanner(addr.Interface()); scanner != nil {
		return scanner
	}
	//fmt.Printf("%+v", columnType)
	var dbType string
	if columnType != nil {
		dbType = columnType.DatabaseTypeName()
	}
	switch dbType {
	case "JSON":
		return nil
	default:
		return &basicScanner{dest: dest}
	}
}
